import React, { Component } from 'react'
import Back from '../Back'

export default class ArticleDetails extends Component {
    goHome = () => {
        // 编程式导航，所有方法都在history里， go、goback、push、replace...
        this.props.history.push('/home')
        // this.props.history.push({
        //     pathname: '/home',
        //     state: {
        //         x: 1
        //     }
        // })
    }
  render() {
    return (
      <div>
        ArticleDetails
        {/* 接收动态路由传值，params */}
        {this.props.match.params.id}
        {/* 编程式导航 */}
        <button onClick={this.goHome}>返回首页</button>
        <Back />
      </div>
    )
  }
}
